//
//  ViewController.m
//  GuMoonNews
//
//  Created by 胡发冬 on 16/8/1.
//  Copyright © 2016年 胡发冬. All rights reserved.
//
//#define screenWidth [[UIScreen mainScreen]bounds].size.width
//#define screenHeight [[UIScreen mainScreen]bounds].size.height



#import "ViewController.h"




@interface ViewController (){
    
    UIViewController *mainViewController;
    UIViewController *startViewController;
    
}

@end

@implementation ViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    //将storyBoard实例化，“Main”为StoryBoard的名称
    UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    
    //将控制器实例化
    mainViewController = [mainStoryBoard instantiateViewControllerWithIdentifier:@"MainViewController"];
    startViewController = [mainStoryBoard instantiateViewControllerWithIdentifier:@"StartViewController"];

    [self performSelector:@selector(judgeLogStatus) withObject:nil afterDelay:0.5f];
    
}
- (void)judgeLogStatus{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    NSLog(@"loginStatus=%@",[userDefaults objectForKey:@"loginStatus"]);
    
    if ([[userDefaults objectForKey:@"loginStatus"]isEqualToString:@"1"]) {
        
        
//        CATransition *animation = [CATransition animation];
//        animation.duration = 1.0;
//        animation.timingFunction = UIViewAnimationCurveEaseInOut;
//        animation.type = kCATransitionFade;
//        
//        
//        [self.view.window.layer addAnimation:animation forKey:nil];
        
        [mainViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
        [self presentViewController:mainViewController animated:YES completion:nil];
        
        // [self.navigationController pushViewController:secondView animated:YES];
        
        
    }else{
        
        
        [startViewController setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
        
        [self presentViewController:startViewController animated:YES completion:nil];
        //[self.navigationController pushViewController:startViewController animated:YES];
        
    }
    
    
}




@end
